<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php $url = HttpUtil::baseUrl(); ?>
    <link rel="shortcut icon" href="<?php echo $url;?>/favicon.ico"></link>
    
    <link href='<?php echo $url;?>/styles/style.css' rel='stylesheet' type='text/css' />
        
    <script type="text/javascript" src="<?php echo $url;?>/scripts/lib/jquery.js"></script>
    <script type="text/javascript" src="<?php echo $url;?>/scripts/lib/jquery.alerts.js"></script>
    <script type="text/javascript" src="<?php echo $url;?>/scripts/common.js"></script>
    <script type="text/javascript" src="<?php echo $url;?>/scripts/inventory.js"></script>

</head>

<body>
<?php 
    $imageId = $this->imageId;
?>

<div style=""><!-- min-height:600px;overflow:scroll; -->

<?php
$itemImages = $this->itemImages;
//print_r($itemImages);
if( empty($itemImages) ){
    $productId = $this->pid;
    $itemId = $this->itemId;
?>

<div class="centerbig_modal_button_center" style="margin-top:30px;height:50px;">
    <label><?php echo $this->translate("emptyData"); ?></label>
</div>

<?php

}else{
    $url = HttpUtil::baseUrl();
    $path = Zend_Registry::get("private_image_domain_path");// $path = "//pi.akimimi.com/p";
    $imgSize = "_400.jpg";
    foreach ($itemImages as $key => $image){
        $id = $image["id"];
        $productId = $image["product_id"];
        $itemId = $image["item_id"];
        $name = $image["name"];
        $defaultImage = $image["default_item_image"];
        $folder = $image["folder"];
        $sortOrder = $image["sort_order"];
        ?>
        <input type="hidden" name="imageId[]" value="<?php echo $id; ?>" />
        
        <div style="width:210px;height:320px;float:left;">
            <?php if($defaultImage == 1){ ?>
            <img id="image_<?php echo $key; ?>" onmouseover="javascript:Inventory.addCSS('image_<?php echo $key; ?>');" onmouseout="javascript:Inventory.delCSS('image_<?php echo $key; ?>');" style="width:200px;height:200px;margin_left:10px;cursor:pointer;border: 1px solid #00FF00;" src="<?php echo $path . $folder . $name . $imgSize; ?>" alt="" onclick="javascript:Inventory.showImageInfo('<?php echo HttpUtil::baseUrl(); ?>', '<?php echo $id; ?>');" />
            <?php }else{ ?>
            <img id="image_<?php echo $key; ?>" onmouseover="javascript:Inventory.addCSS('image_<?php echo $key; ?>');" onmouseout="javascript:Inventory.delCSS('image_<?php echo $key; ?>');" style="width:200px;height:200px;margin_left:10px;cursor:pointer;" src="<?php echo $path . $folder . $name . $imgSize; ?>" alt="" onclick="javascript:Inventory.showImageInfo('<?php echo HttpUtil::baseUrl(); ?>', '<?php echo $id; ?>');" />
            <?php } ?>
            <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <label style="margin-left:0px;*margin-left:0px;margin-top:15px;"><?php echo $this->translate("defaultImage"); ?></label>
            <?php if($defaultImage == 1){ ?>
            <input type="radio" name="defaultImage" value ="<?php echo $id; ?>" checked="checked" style="margin-top:15px;" />
            <?php }else{ ?>
            <input type="radio" name="defaultImage" value ="<?php echo $id; ?>" style="margin-top:15px;" />
            <?php } ?>
            <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <label style="margin-top:15px;"><?php echo $this->translate("sortOrder"); ?></label>
            <input id="sortOrder" style="margin-left:0px;margin-top:15px;" type="text" size="3" name="sortOrder[]" value="<?php echo $sortOrder; ?>" />
            <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="button" style="margin-top:15px;margin-left:30px;" value="<?php echo $this->translate("delBtn"); ?>" onclick="javascript:Inventory.deleteImage('<?php echo HttpUtil::baseUrl();?>', '<?php echo $id; ?>', '<?php echo $itemId; ?>', '<?php echo $productId; ?>');" />
        </div>
        <?php } ?>
        <div class="clear"></div>
        <div class="centerbig_modal_button_center" style="margin-top:30px;">
            <input type="hidden" id="productId" value="<?php echo $productId; ?>" />
            <input type="hidden" id="currentUseItemId" name="currentUseItemId" value="<?php echo $itemId; ?>" />
            <input type="button" style="margin-bottom:50px;" value="<?php echo $this->translate("saveBtn"); ?>" onclick="javascript:Inventory.subEditImage('<?php echo HttpUtil::baseUrl();?>', '<?php echo $itemId; ?>', '<?php echo $productId; ?>');" />
        </div>
<?php 
}
?>
</div>
</body>
</html>
